#!/bin/sh

echo "SLPFindAttrs"
rm -f SLPFindAttrs.actual.output 
scriptdir=${srcdir}/SLPFindAttrs

test -f ${srcdir}/slpd.pid && kill `cat ${srcdir}/slpd.pid` && rm ${srcdir}/slpd.pid
../slpd/slpd -r ${scriptdir}/slp.test.reg -p ${srcdir}/slpd.pid
RESULT=$?
if test $RESULT != 1; then
    echo "Unable to start slpd (error = $RESULT), test failed."
    exit $RESULT
fi

./testslpfindattrs service:test 10.0.0.1 foo >> SLPFindAttrs.actual.output
echo >> SLPFindAttrs.actual.output
./testslpfindattrs service:test 10.0.0.1 goo >> SLPFindAttrs.actual.output
echo >> SLPFindAttrs.actual.output
./testslpfindattrs service:test 10.0.0.1 description >> SLPFindAttrs.actual.output
echo >> SLPFindAttrs.actual.output
./testslpfindattrs service:test 10.0.0.1 "(foo=value1,value2)" foo >> SLPFindAttrs.actual.output
echo >> SLPFindAttrs.actual.output
./testslpfindattrs service:test 10.0.0.1 "(foo=value1,value2)" goo >> SLPFindAttrs.actual.output
echo >> SLPFindAttrs.actual.output
test -f ${srcdir}/slpd.pid && kill `cat ${srcdir}/slpd.pid` && rm ${srcdir}/slpd.pid
diff -c ${scriptdir}/SLPFindAttrs.expected.output SLPFindAttrs.actual.output
